/*
 * @Description:
 * @Author: charles
 * @Date: 2020-10-26 16:39:14
 * @LastEditors: JunyaoPan
 * @LastEditTime: 2021-10-19 17:13:10
 */
import Vue from 'vue'
import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/head',
    name: 'Head',
    meta: {
      scrollToTop: true
    },
    component: () => import('../views/head.vue')
  },
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: '/home',
    name: 'Home',
    meta: {
      scrollToTop: true
    },
    component: () => import('../views/Home.vue')
  },
  {
    // 头条广大
    path: '/DetailList',
    name: 'DetailList',
    meta: {
      scrollToTop: true
    },
    component: () => import('../views/DetailList.vue')
  },
  {
    path: '/Search',
    name: 'Search',
    meta: {
      scrollToTop: true
    },
    component: () => import('../views/Search.vue')
  },
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
